﻿using BCCommon;
using BCCommon.Enums;
using BCDto.Sim.Admin.Admin;
using BCDto.TMS.RedPacket.RedPacket;
using BCDto.Website.User;
using BCDto.WeChatComponent.WeChatUser;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;

namespace BCService.Website.User
{
    /// <summary>
    /// 用户信息服务接口
    /// </summary>
    public interface IUserService
    {
        /// <summary>
        /// 创建用户
        /// </summary>
        /// <param name="userRequestDto">用户信息</param>
        /// <param name="ip">IP地址</param>
        /// <param name="roleType">用户角色</param>
        /// <returns></returns>
        UserDto Create(UserRequestDto userRequestDto, string ip, RoleType roleType);

        /// <summary>
        /// 获取用户信息
        /// </summary>
        /// <param name="userId">用户Id</param>
        /// <returns></returns>
        UserDto GetUserByUserId(long userId);

        /// <summary>
        /// 获取用户信息列表
        /// </summary>
        /// <param name="userName">用户名</param>
        /// <param name="phone">手机号</param>
        /// <param name="identityNumber">身份证编码</param>
        /// <param name="accountStatus">账号状态</param>
        /// <param name="roleType">角色类型</param>
        /// <param name="start">开始时间</param>
        /// <param name="end">结束时间</param>
        /// <param name="ascending">排序</param>
        /// <param name="pageIndex">当前页码</param>
        /// <param name="pageSize">当前页大小</param>
        /// <returns></returns>
        PageableList<WeChatUserInfoDto> GetUserList(string userName, string phone, string identityNumber, AccountStatus? accountStatus, RoleType? roleType, DateTime? start, DateTime? end, bool? ascending, int pageIndex = 1, int pageSize = 10);

        /// <summary>
        /// 获取用户信息
        /// </summary>
        /// <param name="phone">手机号码</param>
        /// <returns></returns>
        UserDto GetUserByPhone(string phone);

        /// <summary>
        /// 更新登录信息
        /// </summary>
        /// <param name="phone">手机号码</param>
        /// <param name="ip">登录者IP</param>
        void UpdateLoginInfo(string phone, string ip);

        /// <summary>
        /// 登录
        /// </summary>
        /// <param name="phone">手机号码</param>
        /// <param name="password">密码</param>
        /// <param name="ip">访问者ip地址</param>
        /// <returns></returns>
        UserDto Logon(string phone, string password, string ip);

        /// <summary>
        /// 更新用户密码
        /// </summary>
        /// <param name="phone">手机号</param>
        /// <param name="password">用户密码</param>
        /// <returns></returns>
        bool UpdatePassword(string phone, string password);

        /// <summary>
        /// 用户修改密码
        /// </summary>
        /// <param name="userDto">用户登录状态信息</param>       
        /// <param name="userPutChangePasswordDto">密码修改信息</param>
        /// <returns></returns>
        bool UserChangePassword(UserDto userDto, UserPutChangePasswordDto userPutChangePasswordDto);

        /// <summary>
        /// 修改用户头像
        /// </summary>
        /// <param name="phone">手机号</param>
        /// <param name="avatar">用户头像</param>
        /// <returns></returns>
        UserDto UpdateAvatar(string phone, string avatar);

        /// <summary>
        /// 修改用户手机
        /// </summary>
        /// <param name="userId">用户Id</param>
        /// <param name="phone">手机号</param>
        /// <param name="password">用户密码</param>
        /// <returns></returns>
        bool UpdatePhone(long userId, string phone, string password);

        /// <summary>
        /// 验证码登录
        /// </summary>
        /// <param name="phone">手机号</param>
        /// <returns></returns>
        UserDto PassCodeLogon(string phone);

        /// <summary>
        /// 微信授权用户(小程序专用)
        /// </summary>
        /// <param name="code">临时登录Code</param>
        /// <returns></returns>
        UserDto WechatUserLogon(string code);

        /// <summary>
        /// 根据unionId获取微信用户信息
        /// </summary>
        /// <param name="unionId">unionId</param>
        /// <returns></returns>
        WeChatUserInfoDto GetWechatUserByUnionId(string unionId);

        /// <summary>
        /// 绑定微信账号
        /// </summary>
        /// <param name="user">当前登录用户</param>
        /// <param name="code">临时登录Code</param>
        /// <returns></returns>
        WeChatUserInfoDto BindWechat(UserDto user, string code);

        /// <summary>
        /// 解除绑定微信账号
        /// </summary>
        /// <param name="user">当前登录用户</param>
        /// <returns></returns>
        void UnBindWechat(UserDto user);

        /// <summary>
        /// 修改用户昵称
        /// </summary>
        /// <param name="userId">用户Id</param>
        /// <param name="nickName">用户昵称</param>
        /// <returns></returns>
        UserDto UpdateNickName(long userId, string nickName);

        /// <summary>
        /// 后台更改用户信息
        /// </summary>
        /// <param name="userId">用户Id</param>
        /// <param name="userSimPutDto">后台更改用户信息</param>
        /// <returns></returns>
        UserDto UpdateUserInfo(long userId, UserSimPutDto userSimPutDto);
        /// <summary>
        /// 领取红包
        /// </summary>
        /// <param name="userInfo">用户信息</param>
        /// <param name="redPacketId">红包id</param>
        /// <param name="countyCode">区编码</param>
        /// <returns></returns>
        bool ReceiveRedPacket(UserDto userInfo, long redPacketId, string countyCode);

        /// <summary>
        /// 获取剩余红包
        /// </summary>
        /// <param name="countyCode"></param>
        /// <returns></returns>
        RedPacketDto GetRemainRedPacket(string countyCode);

        /// <summary>
        /// 用户实名认证
        /// </summary>
        /// <param name="userInfo">用户信息</param>
        /// <param name="verifiesRequestDto">认证请求信息</param>
        /// <returns></returns>
        UserDto RealNameVerifies(UserDto userInfo, UserRealNameVerifiesRequestDto verifiesRequestDto);
        /// <summary>
        /// 用户实名认证
        /// </summary>
        /// <param name="admint">当前审核人员</param>
        /// <param name="userId">用户信息</param>
        /// <param name="dto">审核信息</param>
        /// <returns></returns>
        UserDto RealNameVerifiesApprove(AdminDto admint, long userId, UserApproveRequestDto dto);
    }
}
